package com.come4loves.game.module.skill.skillactorimpl;

import java.util.List;

import org.springframework.stereotype.Component;

import com.come4loves.game.module.fight.action.CardToLocationAction;
import com.come4loves.game.module.fight.constants.CardLocation;
import com.come4loves.game.module.fight.model.FightCard;
import com.come4loves.game.module.fight.model.FightContext;
import com.come4loves.game.module.skill.AbstractSkillActorParser;
import com.come4loves.game.module.skill.model.SkillModel;
/**
 * 弃掉N张牌
 * @author jerry
 *
 */
@Component
public class DropCardSkill extends AbstractSkillActorParser {

	@Override
	public String skillId() {
		return "discard";
	}

	@Override
	public void handerSkill(SkillModel skillModel, FightContext fightContext) {

		int effectValue = Integer.valueOf(skillModel.getEffect().get(skillId()));
		List<FightCard> result = fightContext.beActorBattle.dropHandCard(effectValue);
		
		for (FightCard fightCard : result) {
			CardToLocationAction cardToLocationAction = CardToLocationAction.createFromCard(fightCard, CardLocation.DISCARD);
			fightContext.actionRecorder.addAction(cardToLocationAction);
		}
	}

}
